let unameLocal =
  (new Date).getTime() > localStorage.getItem('expires')
    ? null
    : localStorage.getItem('uname');
let unameSession = sessionStorage.getItem('uname')
let uname = unameLocal || unameSession
let token = unameLocal ? localStorage.getItem('token') : sessionStorage.getItem('token')
let loginHtml = ''
if (uname) {
  loginHtml += `<!-- 已登录 -->
  <a href="./member.html">${uname}</a>
  <a href="./logout.html">退出</a>
  <!-- 已登录 -->`
} else {
  loginHtml += `<!-- 未登录 -->
  <a href="./login.html">你好，请登录</a>
  <a href="./registry.html">免费注册</a>
  <a href="./order.html">我的订单</a>
  <!-- 未登录 -->
  `
}
document.write(
  `
  <header>
  <div class="bar">
    <div class="bar-content">
      <!-- city -->
      <div class="city">
        <i class="iconfont icon-zuobiao"></i>
        <span class="choose-city">南京</span>

        <!-- 请手动选择 -->
        <div class="area">
          <div class="change-city">切换城市<b></b></div>
          <div class="box">
            <ul class="tab">
              <li class="cur">请选择</li>
              <li class="">请选择</li>
              <li class="">请选择</li>
            </ul>
            <div class="tab-content">
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京1</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京2</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京3</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
            </div>
            <div class="tab-content" style="display: none;">
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京4</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京5</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京6</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
            </div>
            <div class="tab-content" style="display: none;">
              <div class="city" area-id="1"><a href="javascript:;">北京7</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京8</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京9</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
              <div class="city" area-id="1"><a href="javascript:;">北京</a><span>-</span></div>
            </div>
          </div>
        </div>
        <!-- 请手动选择 -->
      </div>
      <!-- city -->

      <!-- login -->
      <div class="login">
        ${loginHtml}
      </div>
      <!-- login -->
    </div>
  </div>
  <div class="content">
    <a href = './index.html'><img src="./imgs/logo.png" alt="" class="logo"></a>
    <div class="search">
      <input class="header-search-input" type="text" placeholder="搜索商家或地点">
      <button class="header-search-btn"><span
          class="header-icon icon-search-new iconfont icon-search"></span></button>
    </div>
    <div></div>
  </div>
</header>

<script src="./js/jquery-1.8.3.min.js"></script>
  
  <script src="./js/location.js"></script>
  <script src="./js/chooseLocation.js"></script>
  <script src="./js/driver.js"></script>
  `)